﻿using SqlSugar;
using System.Collections.Generic;
using System.ComponentModel;

namespace MESPro.Models
{
    /// <summary>
    /// 树形结构控件
    /// </summary>
    [Tenant("Default")]
    public class DbControl : EntityBaseIdNameCreat
    {
        /// <summary>
        /// 导航到所属父类,每个控件都会有这个属性,表示他属于哪个页面的控件
        /// </summary>
        public int FunctionId { get; set; }

        /// <summary>
        /// 控件树父级Id
        /// </summary>
        public int ParentId { get; set; }

        /// <summary>
        /// 控件树Id,不能用本来Id来关联,算法不好写
        /// </summary>
        [SugarColumn(IsTreeKey = true)]  //设置关联字段
        public int TreeCode { get; set; }

        /// <summary>
        /// 此控件的Child集合
        /// </summary>
        [SqlSugar.SugarColumn(IsIgnore = true)]
        public List<DbControl>? Child { get; set; }

        /// <summary>
        /// 页面或者控件的属性,图标啊,背景色啊,对齐啊,数据源啊等等..
        /// </summary>
        [SugarColumn(IsJson = true, IsNullable = true)]
        [DisplayName("外观样式设置"), Description("外观样式设置"), Category("属性配置")]
        [TypeConverter(typeof(ExpandableObjectConverter))]
        public Style Style { get; set; } = new Style();
    }





}
